package com.itheima.reggie;

import com.github.wxpay.sdk.WXPay;
import com.itheima.reggie.config.MyConfig;

import java.util.HashMap;
import java.util.Map;

public class Demo {
    public static void main(String[] args) throws Exception {
        MyConfig mc = new MyConfig();
        WXPay wxPay = new WXPay(mc);
        HashMap<String, String> map = new HashMap<>();

        map.put("body","红烧肉套餐");
        map.put("out_trade_no","1478681289451229185");
        map.put("total_fee","1");
        map.put("spbill_create_ip","127.0.0.1");
        //回调通知  商家接收微信的信息的接口
        map.put("notify_url","http://www.baidu.com");
        //支付类型
        map.put("trade_type","NATIVE");
        Map<String, String> responseMap = wxPay.unifiedOrder(map);
        /*{nonce_str=Amyr7GzNaJTzlto5, code_url=weixin://wxpay/bizpayurl?pr=rXqLMmxzz,
        appid=wx8397f8696b538317, sign=20F26B596F8578BE9BFAC7569B34F3558046EC4BD66DCB33F1CE9C7C300AF56E,
        trade_type=NATIVE, return_msg=OK, result_code=SUCCESS,
        mch_id=1473426802, return_code=SUCCESS,
        prepay_id=wx0611123341341334a0adbcd53db2690000}*/
        System.out.println(responseMap);
    }
}
